﻿/*
 * Created by SharpDevelop.
 * User: ratul
 * Date: 3/3/2010
 * Time: 5:34 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using CbSample = H264Impl.NET.Sample.ChromaSample;
using CrSample = H264Impl.NET.Sample.ChromaSample;

using System.Collections;
using System.Collections.Generic;

namespace H264Impl.NET
{
	/// <summary>
	/// Description of DecodePicture.
	/// </summary>
	public class DecodedPicture
	{
		public DecodedPicture(SampleType sampleType, ChromaFormat chromaFormat, UInt16 chromaFormatIdc, UInt16 separateColorPlaneFlag)
		{
			if(chromaFormatIdc==1 && separateColorPlaneFlag==0 && chromaFormat== ChromaFormat.COLOUR_420)
			{
				subWidthC = 2;
				subHeightC = 2;
			}
			else if(chromaFormatIdc==2 && separateColorPlaneFlag==0 && chromaFormat== ChromaFormat.COLOUR_422)
			{
				subWidthC = 2;
				subHeightC = 1;
			} 
			else if(chromaFormatIdc==3 && separateColorPlaneFlag==0 && chromaFormat== ChromaFormat.COLOUR_444)
			{
				subWidthC = 1;
				subHeightC = 1;
			}
			else
				throw new Exception();
			
			this.chromaFormatIdc = chromaFormatIdc;
			this.separateColorPlaneFlag = separateColorPlaneFlag;
			
			if(chromaFormat== ChromaFormat.MONOCHROME)
				sampleType = SampleType.LUMA_ONLY;
			else if(chromaFormat==ChromaFormat.COLOUR_420 || chromaFormat==ChromaFormat.COLOUR_422 || chromaFormat==ChromaFormat.COLOUR_444)
				sampleType = SampleType.LUMA_AND_TWO_CHROMA;
		
		
		
		}
		
		public enum SampleType 
		{
			LUMA_ONLY,
			LUMA_AND_TWO_CHROMA,
			RGB,
			XYZ
		}
		
		public enum ChromaFormat
		{
			MONOCHROME,
			COLOUR_420,
			COLOUR_422,
			COLOUR_444	
		}
		
		SampleType sampleType;
		
		Sample.LumaSample[] 	  lumaArray;
		CbSample[] 			      cbSample;
		CrSample[]		          crSample;
		
		Sample.BaseSample[]            auxiliaryArray;
		
		UInt32 subWidthC;
		UInt32 subHeightC;
		UInt16 chromaFormatIdc;
		UInt16 separateColorPlaneFlag;
		
		ChromaFormat chromaFormat;
		
		List<Slice.BaseSlice> sliceList = new List<Slice.BaseSlice>();
		
		
		
		
	}
}
